﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
  <xs:element name="Kwp71Ecu">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Model" type="xs:string" />
        <xs:element name="ConvertorType" type="xs:string" />
        <xs:element name="ActuatorRoutine">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" maxOccurs="unbounded" name="unsignedByte" type="xs:unsignedByte" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="ErrorMemoryStructureDefinition">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Lenght" type="xs:unsignedByte" />
              <xs:element name="ErrorDefinitions">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="ErrorDefinition">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="ErrorCode" type="xs:string" />
                          <xs:element name="ErrorDescription" type="xs:string" />
                          <xs:element name="ErrorElements">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element maxOccurs="unbounded" name="ElementDefinition">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="Name" type="xs:string" />
                                      <xs:element name="ConversionId" type="xs:int" />
                                      <xs:element name="Units" type="xs:string" />
                                      <xs:element name="ByteIndex" type="xs:unsignedByte" />
                                      <xs:element name="ByteLenght" type="xs:unsignedByte" />
                                      <xs:element name="BitShift" type="xs:unsignedByte" />
                                      <xs:element name="Bitmask" type="xs:unsignedInt" />
                                      <xs:element name="MaskMatches">
                                        <xs:complexType>
                                          <xs:sequence minOccurs="0">
                                            <xs:element maxOccurs="unbounded" name="MaskMatch">
                                              <xs:complexType>
                                                <xs:sequence>
                                                  <xs:element name="MatchValue" type="xs:boolean" />
                                                  <xs:element name="MaskValue" type="xs:unsignedByte" />
                                                  <xs:element name="MaskResultTrue" type="xs:string" />
                                                  <xs:element name="MaskResultFalse" minOccurs="0"/>
                                                </xs:sequence>
                                              </xs:complexType>
                                            </xs:element>
                                          </xs:sequence>
                                        </xs:complexType>
                                      </xs:element>
                                      <xs:element name="LittleEndian" type="xs:boolean" />
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="EcuAddress" type="xs:unsignedByte" />
        <xs:element name="EcuWarning" />
        <xs:element name="Routines">
          <xs:complexType>
            <xs:sequence>
              <xs:element  minOccurs="0" maxOccurs="unbounded" name="IsoRoutine">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Id" type="xs:unsignedShort" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="SnapshotDefinitions" type="xs:string" />
        <xs:element name="Sensors">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="IsoSensor">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Name" type="xs:string" />
                    <xs:element name="ConversionId" type="xs:int" />
                    <xs:element name="Units" type="xs:string" />
                    <xs:element name="ByteIndex" type="xs:unsignedByte" />
                    <xs:element name="ByteLenght" type="xs:unsignedByte" />
                    <xs:element name="BitShift" type="xs:unsignedByte" />
                    <xs:element name="Bitmask" type="xs:unsignedInt" />
                    <xs:element name="MaskMatches">
                      <xs:complexType>
                        <xs:sequence minOccurs="0">
                          <xs:element maxOccurs="unbounded" name="MaskMatch">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="MatchValue" type="xs:boolean" />
                                <xs:element name="MaskValue" type="xs:unsignedByte" />
                                <xs:element name="MaskResultTrue" type="xs:string" />
                                <xs:element name="MaskResultFalse" />
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="LittleEndian" type="xs:boolean" />
                    <xs:element name="UpperLimit" type="xs:float" />
                    <xs:element name="LowerLimit" type="xs:float" />
                    <xs:element name="FlagType" type="xs:boolean" />
                    <xs:element name="Id" type="xs:unsignedShort" />
                    <xs:element name="SensorType" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Actuators">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="IsoActuator">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Name" type="xs:string" />
                    <xs:element name="Warning" type="xs:string" />
                    <xs:element name="Message" type="xs:string" />
                    <xs:element name="ImageName" type="xs:string" />
                    <xs:element name="Duration" type="xs:unsignedByte" />
                    <xs:element name="Id" type="xs:unsignedByte" />
                    <xs:element name="ActivationType" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="RpmSensor">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Name" type="xs:string" />
              <xs:element name="ConversionId" type="xs:unsignedByte" />
              <xs:element name="Units" type="xs:string" />
              <xs:element name="ByteIndex" type="xs:unsignedByte" />
              <xs:element name="ByteLenght" type="xs:unsignedByte" />
              <xs:element name="BitShift" type="xs:unsignedByte" />
              <xs:element name="Bitmask" type="xs:unsignedByte" />
              <xs:element name="MaskMatches" />
              <xs:element name="LittleEndian" type="xs:boolean" />
              <xs:element name="UpperLimit" type="xs:unsignedShort" />
              <xs:element name="LowerLimit" type="xs:unsignedByte" />
              <xs:element name="FlagType" type="xs:boolean" />
              <xs:element name="Id" type="xs:unsignedShort" />
              <xs:element name="SensorType" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="SpeedSensor">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Name" type="xs:string" />
              <xs:element name="ConversionId" type="xs:unsignedByte" />
              <xs:element name="Units" type="xs:string" />
              <xs:element name="ByteIndex" type="xs:unsignedByte" />
              <xs:element name="ByteLenght" type="xs:unsignedByte" />
              <xs:element name="BitShift" type="xs:unsignedByte" />
              <xs:element name="Bitmask" type="xs:unsignedByte" />
              <xs:element name="MaskMatches" />
              <xs:element name="LittleEndian" type="xs:boolean" />
              <xs:element name="UpperLimit" type="xs:unsignedByte" />
              <xs:element name="LowerLimit" type="xs:unsignedByte" />
              <xs:element name="FlagType" type="xs:boolean" />
              <xs:element name="Id" type="xs:unsignedShort" />
              <xs:element name="SensorType" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xsd:schema>